home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / program / swagd_f.zip / DATETIME.SWG / 0053_Show Date-Time.pas < prev    next >
Pascal/Delphi Source File  |  1995-02-28  |  2KB  |  72 lines

  1. program dt;
  2.  
  3.  
  4. uses Dos;
  5. const
  6.    id = 'Tansin A Darcos & Company, P O Box 70970, SW DC 20024-0970 ' +
  7.         '"Ask about our software catalog."'+
  8.         '░░▒▒▓▓██ In Stereo Where Available ██▓▓▒▒░░  '+
  9.         'Stolen tagline: "Special favors come in 31 flavors... Pass ' +
  10.         'the mints... I''m out of Life Savers."   Just don''t sue us '  +
  11.         'if you use this. ';
  12.  
  13.  
  14. var
  15.   i, y, m, d, h, s, hund, dow : Word;
  16.   ch : char;
  17.   cc : string[2];
  18.  
  19.   procedure date;
  20.   begin
  21.   GetDate(y,m,d,dow);
  22.   WriteLn(m:0, '/', d:0, '/', y:0);
  23.   end;
  24.  
  25.   procedure time;
  26.   begin
  27.   GetTime(h,m,s,hund);
  28.   WriteLn(h,':',m,':',s);
  29.   end;
  30.  
  31.   procedure help;
  32.   begin
  33.   writeln('  Shows Date and / or time        [TDR]');
  34.   writeln('DT [ dt | d | t | td | /? ] [>file.txt]');
  35.   writeln('            dt - (or no arguments) Shows date, then time');
  36.   writeln('            d  - show date only');
  37.   writeln('            t  - show time');
  38.   writeln('            td - show time then date');
  39.   writeln('            /? - show this message');
  40.   writeln('     >file.txt - optionally send output to file.txt');
  41.   end;
  42.  
  43. begin
  44.     cc := 'DT';
  45.     if paramcount<>0 then
  46.       cc := paramstr(1);
  47.     for i := 1 to Length(cc) do
  48.       cc[i] := UpCase(cc[i]);
  49.     ch := cc[1];
  50.     if cc = '/?' then
  51.       help
  52.     else
  53.       if length(cc) = 1 then
  54.         if ch = 'D' then
  55.           date
  56.         else
  57.           time
  58.       else
  59.         if (cc = 'TD') then
  60.           begin
  61.              time;
  62.              date
  63.           end
  64.        else
  65.           begin
  66.              date;
  67.              time
  68.           end
  69. end.
  70.  
  71.  
  72.